//package com.preparation.controller;
//
//import com.preparation.dto.R;
//import com.preparation.untils.AliOssUtil;
//import org.springframework.web.bind.annotation.CrossOrigin;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import org.springframework.web.multipart.MultipartFile;
//
//import java.util.UUID;
//
//@CrossOrigin
//@RestController
//@RequestMapping("/files2")
//public class FileController2 {
//
//    @PostMapping("/upload")
//    public R upload(MultipartFile file) throws Exception{
//        //把文件的内容存储到本地磁盘上
//        String originalFileName = file.getOriginalFilename();
//        //保证文件的名字是唯一的，防止文件被覆盖
//        String fileName = UUID.randomUUID().toString() + originalFileName.substring(originalFileName.lastIndexOf("."));
//        String url = AliOssUtil.uploadFile(fileName, file.getInputStream());
//        return new R(true, url, "操作成功");
//    }
//
//}
